<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\DetailView;
use kartik\editable\Editable;

$this->title = '合同详情';
$this->params['breadcrumbs'][] = ['label' => '合同列表', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>

<style type="text/css">
    .content-view{padding:10px 20px;margin-top:5px; border:1px solid #d2d6de}  
    .view-one{margin-top: 5px;}  
</style>

<div class="contract-view">

    <div class="box">
        <div class="box-header">
            商务
        </div>

         <div class="box-body"> 
            <div class="content-view">

                <div class="row view-one">
                    <div class="col-md-3">
                        <label>合同编号：</label><?=$model->code?>
                    </div>
                    <div class="col-md-3">
                        <label>创建人：</label><?=$model->userName?>
                    </div>
                    <div class="col-md-3">
                        <label>状态：</label>
                        <?php 
                         $contract_status = [2 => '已订货', 3 => '已发货',];
                         echo Editable::widget([
                                'name'=>'Contract[status]',
                                'header' => '合同状态',
                                'displayValue' => Yii::$app->params['contract_status'][$model->status],
                                'value' => Yii::$app->params['contract_status'][$model->status],
                                'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                                'format' => Editable::FORMAT_BUTTON,
                                'inputType' => Editable::INPUT_DROPDOWN_LIST,
                                'data'=> $contract_status, 
                                'options' => ['class'=>'form-control'],
                                'editableValueOptions' => ['class'=>'text-danger'],
                                'displayValueConfig' => Yii::$app->params['contract_status']
                            ]);
                         ?>
                    </div>
                </div>

                <div class="row view-one">
                    <div class="col-md-3">
                        <label>客户名称：</label><?=$model->customer->name?>
                    </div>
                    <div class="col-md-3">
                        <label>销售员：</label><?=$model->saleName?>
                    </div> 
                    <div class="col-md-3">
                        <label>合同币种：</label> <?=isset(Yii::$app->params['currency_type'][$model->sale_currency])?Yii::$app->params['currency_type'][$model->sale_currency]:''?>
                    </div>
                    <div class="col-md-3">
                        <label>合同金额：</label><?=$model->sale_price?>
                    </div> 
                </div>

            </div>

            <div class="content-view">
                <div class="row view-one">
                    <div class="col-md-3">
                        <label>收款方式：</label>

                        <?php echo Editable::widget([
                            'name' => 'Contract[payment_type]',
                            'value' => $model->payment_type,
                            'asPopover' => true,
                            'header' => '收款方式',
                            'size'=>'md',
                            'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                            'options' => ['class'=>'form-control', 'placeholder'=>'收款方式'],
                        ]);?>

                    </div>
                    <div class="col-md-3">
                        <label>收款币种：</label>
                        <?php echo Editable::widget([
                                'name'=>'Contract[pay_currency]',
                                'header' => '收款币种',
                                'displayValue' => isset(Yii::$app->params['currency_type'][$model->pay_currency]) ? Yii::$app->params['currency_type'][$model->pay_currency] : '',
                                'value' => isset(Yii::$app->params['currency_type'][$model->pay_currency]) ? Yii::$app->params['currency_type'][$model->pay_currency] : '',
                                'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                                'inputType' => Editable::INPUT_DROPDOWN_LIST,
                                'asPopover' => true,
                                'header' => '收款币种',
                                'data'=> Yii::$app->params['currency_type'], 
                                'options' => ['class'=>'form-control'],
                                'displayValueConfig' => Yii::$app->params['currency_type']
                            ]);
                        ?>
                    </div> 
                    <div class="col-md-3">
                        <label>收款金额：</label>
                        <?php echo Editable::widget([
                            'name' => 'Contract[pay_price]',
                            'value' => $model->pay_price,
                            'asPopover' => true,
                            'header' => '收款金额',
                            'size'=>'md',
                            'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                            'options' => ['class'=>'form-control', 'placeholder'=>'收款金额'],
                        ]);?>
                    </div>
                </div>

                <div class="row view-one">
                    <div class="col-md-3">
                        <label>差额币种：</label>
                        <?php echo Editable::widget([
                                'name'=>'Contract[exchange_currency]',
                                'header' => '差额币种',
                                'displayValue' => isset(Yii::$app->params['currency_type'][$model->exchange_currency]) ? Yii::$app->params['currency_type'][$model->exchange_currency] : '',
                                'value' => isset(Yii::$app->params['currency_type'][$model->exchange_currency]) ? Yii::$app->params['currency_type'][$model->exchange_currency] : '',
                                'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                                'inputType' => Editable::INPUT_DROPDOWN_LIST,
                                'asPopover' => true,
                                'data'=> Yii::$app->params['currency_type'], 
                                'options' => ['class'=>'form-control'],
                                'displayValueConfig' => Yii::$app->params['currency_type']
                            ]);
                        ?>
                    </div>
                    <div class="col-md-3">
                        <label>汇兑差额：</label>
                        <?php echo Editable::widget([
                            'name' => 'Contract[exchange_price]',
                            'value' => $model->exchange_price,
                            'asPopover' => true,
                            'header' => '汇兑差额',
                            'size'=>'md',
                            'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                            'options' => ['class'=>'form-control', 'placeholder'=>'汇兑差额'],
                        ]);?>
                    </div> 
                    <div class="col-md-3">
                        <label>快递号：</label>
                        <?php echo Editable::widget([
                            'name' => 'Contract[express_num]',
                            'value' => $model->express_num,
                            'asPopover' => true,
                            'header' => '快递号',
                            'size'=>'md',
                            'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                            'options' => ['class'=>'form-control', 'placeholder'=>'快递号'],
                        ]);?>
                    </div>
                </div>
            </div>

            <div class="content-view">
                <div class="row view-one">
                    <div class="col-md-3">
                        <label>是否开票：</label><?=isset(Yii::$app->params['confirm'][$model->is_invoice])?Yii::$app->params['confirm'][$model->is_invoice]:''?>
                    </div>
                    <div class="col-md-3">
                        <label>开票日期：</label><?=$model->invoice_date?>
                    </div> 
                    <div class="col-md-3">
                        <label>开票号：</label><?=$model->invoice_no?>
                    </div>
                </div>

                <div class="row view-one">
                    <div class="col-md-3">
                        <label>开票公司：</label><?=$model->invoice_company?>
                    </div>
                    <div class="col-md-3">
                        <label>开票币种：</label><?=isset(Yii::$app->params['currency_type'][$model->invoice_currency])?Yii::$app->params['currency_type'][$model->invoice_currency]:''?>
                    </div> 
                    <div class="col-md-3">
                        <label>开票金额：</label><?=$model->invoice_price?>
                    </div>
                </div>
            </div>

            <div class="content-view">
                <div class="row view-one">
                    <div class="col-md-3">
                        <label>是否回款：</label> <?=isset(Yii::$app->params['confirm'][$model->is_back])?Yii::$app->params['confirm'][$model->is_back]:''?>
                    </div>
                    <div class="col-md-3">
                        <label>回款日期：</label><?=$model->back_date?>
                    </div> 
                    <div class="col-md-3">
                        <label>回款公司：</label><?=$model->back_company?>
                    </div>
                </div>

                <div class="row view-one">
                    <div class="col-md-3">
                        <label>回款币种：</label><?=isset(Yii::$app->params['currency_type'][$model->back_currency])?Yii::$app->params['currency_type'][$model->back_currency]:''?>
                    </div>
                    <div class="col-md-3">
                        <label>回款金额：</label><?=$model->back_price?>
                    </div> 
                </div>
            </div>


        </div>      
    </div>

</div>
